#!/bin/bash
#author 无良小万

# 判断是否存在.vim文件夹
if [ ! -d ~/.vim/ ];then
    mkdir .vim
fi

# 判断是否已经下载过config
if [ -d ~/.vim/self-vim-config/ ];then
    rm -rf ~/.vim/self-vim-config/
fi
git clone --depth=1 https://gitee.com/cherry-xw/self-vim-config.git ~/.vim/self-vim-config/
echo -e '配置文件下载完成\n'
# 判断是否已经下载过Vundle
if [ -d ~/.vim/bundle/Vundle.vim ];then
    rm -rf ~/.vim/bundle/Vundle.vim
fi
git clone --depth=1 https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
echo -e 'Vundle插件下载完成\n'

if [ -f ~/.vimrc ];then
    mv ~/.vimrc ~/.vim/self-vim-config/.vimrc.backup
fi
echo -e '插件备份完成，备份目录~/.vim/self-vim-config/.vimrc.backup\n执行 mv ~/.vim/self-vim-config/.vimrc.backup ~/.vimrc 将还原备份数据\n'

cp ~/.vim/self-vim-config/vimrc ~/.vimrc
echo '执行成功，下面执行vim命令，输入:PluginInstall安装Vundle插件'
